/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author atikahSH
 */
@Entity
@Table(name = "history_orders", catalog = "apoltek", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "HistoryOrder.findAll", query = "SELECT h FROM HistoryOrder h"),
    @NamedQuery(name = "HistoryOrder.findByIdOrder", query = "SELECT h FROM HistoryOrder h WHERE h.idOrder = :idOrder"),
    @NamedQuery(name = "HistoryOrder.findByNamaOrder", query = "SELECT h FROM HistoryOrder h WHERE h.namaOrder = :namaOrder"),
    @NamedQuery(name = "HistoryOrder.findByNomerPO", query = "SELECT h FROM HistoryOrder h WHERE h.nomerPO = :nomerPO"),
    @NamedQuery(name = "HistoryOrder.findByTanggalOrder", query = "SELECT h FROM HistoryOrder h WHERE h.tanggalOrder = :tanggalOrder"),
    @NamedQuery(name = "HistoryOrder.findByJumlahObat", query = "SELECT h FROM HistoryOrder h WHERE h.jumlahObat = :jumlahObat"),
    @NamedQuery(name = "HistoryOrder.findByTotalOrder", query = "SELECT h FROM HistoryOrder h WHERE h.totalOrder = :totalOrder")})
public class HistoryOrder implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_ORDER", nullable = false)
    private Integer idOrder;
    @Column(name = "NAMA_ORDER", length = 100)
    private String namaOrder;
    @Column(name = "NOMER_PO", length = 100)
    private String nomerPO;
    @Column(name = "TANGGAL_ORDER", length = 20)
    private String tanggalOrder;
    @Column(name = "JUMLAH_OBAT")
    private Integer jumlahObat;
    @Column(name = "TOTAL_ORDER")
    private Integer totalOrder;
    @JoinColumn(name = "ID_OBAT", referencedColumnName = "ID_OBAT")
    @ManyToOne(fetch = FetchType.LAZY)
    private Obat idObat;

    public HistoryOrder() {
    }

    public HistoryOrder(Integer idOrder) {
        this.idOrder = idOrder;
    }

    public Integer getIdOrder() {
        return idOrder;
    }

    public void setIdOrder(Integer idOrder) {
        this.idOrder = idOrder;
    }

    public String getNamaOrder() {
        return namaOrder;
    }

    public void setNamaOrder(String namaOrder) {
        this.namaOrder = namaOrder;
    }

    public String getNomerPO() {
        return nomerPO;
    }

    public void setNomerPO(String nomerPO) {
        this.nomerPO = nomerPO;
    }

    public String getTanggalOrder() {
        return tanggalOrder;
    }

    public void setTanggalOrder(String tanggalOrder) {
        this.tanggalOrder = tanggalOrder;
    }

    public Integer getJumlahObat() {
        return jumlahObat;
    }

    public void setJumlahObat(Integer jumlahObat) {
        this.jumlahObat = jumlahObat;
    }

    public Integer getTotalOrder() {
        return totalOrder;
    }

    public void setTotalOrder(Integer totalOrder) {
        this.totalOrder = totalOrder;
    }

    public Obat getIdObat() {
        return idObat;
    }

    public void setIdObat(Obat idObat) {
        this.idObat = idObat;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idOrder != null ? idOrder.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HistoryOrder)) {
            return false;
        }
        HistoryOrder other = (HistoryOrder) object;
        if ((this.idOrder == null && other.idOrder != null) || (this.idOrder != null && !this.idOrder.equals(other.idOrder))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.HistoryOrder[ idOrder=" + idOrder + " ]";
    }

}
